<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of base
 *
 * @author tann
 */
abstract class BaseController extends Zend_Controller_Action{
    //put your code here
    public function getRole(){
        //current user id 
        $auth = Zend_Auth::getInstance();
        $id = $auth->getIdentity()->id;
        $model = new Application_Model_DbTable_User();
        $user = $model->find($id)->current();
        $role = $user->findManyToManyRowset('Application_Model_DbTable_Role', 'Application_Model_DbTable_RoleUser')->toArray();
        return (is_array($role)?$role[0]['name']:"guest");
        
    }
}

?>
